/****************************************************************************
 * Copyright (C) 2025 Chenyz. All rights reserved.
 *
 * @file    TinyOS_Hook.c
 *
 * @par     dependencies
 *          - TinyOS_Hook.h (Hook function definitions)
 *          - TinyOS_Config.h (Configuration parameters)
 *
 * @author  Chenyz
 *
 * @brief   System Hook Functions Module for TinyOS with following features:
 *          - User-definable system event hooks for customization
 *          - CPU idle state monitoring and customization
 *          - System tick event interception and processing
 *          - Task switching observation and profiling
 *          - Task initialization monitoring and customization
 *          - Conditional compilation based on configuration
 *          - Cross-platform compatibility (bare-metal/RTOS systems)
 *
 * @version V1.0
 * @date    2025-10-03
 *
 * @note    Coding standard:
 *          - 4 spaces per indent level
 *          - Follow MISRA-C 2012 guidelines
 *          - Compiler compatibility: C99 and above
 *          - Hook functions are empty by default and should be overridden
 *          - by application code for custom system behavior monitoring
 ****************************************************************************/

#include "TinyOS_Hook.h"

/* Hook function implementations - conditionally compiled based on configuration */
#if TINYOS_ENABLE_HOOK == 1
	
/**
 * @brief CPU idle state hook function
 * 
 * This hook is called when the system enters the idle state.
 * Applications can override this function to implement custom
 * power management, background processing, or system monitoring.
 */
void TinyOS_HookCpuIdle(void)
{
	/* Default empty implementation - override in application code */
}

/**
 * @brief System tick hook function
 * 
 * This hook is called on each system tick interrupt.
 * Applications can use this for time-based custom processing,
 * performance monitoring, or periodic background tasks.
 */
void TinyOS_HookSystick(void)
{
	/* Default empty implementation - override in application code */
}

/**
 * @brief Task switching hook function
 * 
 * This hook is called whenever a task context switch occurs.
 * Applications can use this for task profiling, scheduling
 * analysis, or custom context management.
 * 
 * @param From Pointer to the task being switched out
 * @param To Pointer to the task being switched in
 */
void TinyOS_HookTaskSwitch(TinyOS_TaskType* From, TinyOS_TaskType* To)
{
	/* Default empty implementation - override in application code */
}

/**
 * @brief Task initialization hook function
 * 
 * This hook is called when a new task is initialized.
 * Applications can use this for task monitoring, custom
 * initialization, or resource allocation tracking.
 * 
 * @param Task Pointer to the newly initialized task
 */
void TinyOS_HookTaskInit(TinyOS_TaskType* Task)
{
	/* Default empty implementation - override in application code */
}

#endif /* TINYOS_ENABLE_HOOK */
